Backing up and Restoring a Single Database via SSH

At the moment, taking backups for a single database is not available in the Control Panel. This article will explain how you can back up and restore a single database via SSH.

Note: For security reasons, only the accounts have passed our verification will be granted permission to the Shell / SSH service. If you would like to enable it, please update your billing information. Our staff will finish verifying your information within 2 hours.

Backup

1. Locate the target deployment

Log in to the Control Panel and locate your target deployment on the Home page or the My Applications page.

2. Navigate to the Shell / SSH page

Click the "Manage" button on the Home page or the My Applications page to go to the Shell / SSH page.

3. Back up a database

  1. Connect to the database

    Click the “Connect” icon on the Shell / SSH page to launch the command-line interface.

    For security reasons, only the accounts have passed our verification will be granted permission to the Shell / SSH service. If you would like to enable it, please update your billing information. Our staff will finish verifying your information within 2 hours.

  2. Log in to the database

    Input the command "sqlcmd -U <db_user> -P <password> -N -C", followed by pressing the “Enter” key.

    <db_user>:the user name of the database you would like to back up.

    <password>: the password of your database user.

  3. Make a backup

    Type in the command "backup database <db_name> to disk='<file>' ", and press the "Entry" key, followed by entering the "go" command to initiate the backup process.

    <db_name>:the database you would like to back up.

    <file>:the destination and the file name of the backup file.

    e.g. backup database test to disk='/cloudclusters/test.bak'

  4. View the backup file

    Once the backup process finishes, type in the "exit" command to log out, followed by the "ls" command to view the backup file.

4. Modify file permission

Before you can download the file, you need to modify the file permission so you can perform the download operation.

  1. Launch the shell / SSH in the client panel and go to the folder the backup file is in by using "cd <folder_name>" command.

  2. Enter the "ls" command to view all files in the folder

  3. Input "chmod 644 <file_name>" to modify the file permission.

5. Export files

You can download the file on your local machine using FTPS. For details, please take a look at the documentation.

Restoration

1. Locate the target deployment

Log in to the Control Panel and locate your target deployment on the Home page or the My Applications page.

2. Navigate to the Shell / SSH page

Click the "Manage" button on the Home page or the My Applications page to go to the Shell / SSH page.

3. Restore the database

  1. Connect to the database

    Click the “Connect” icon on the Shell / SSH page to launch the command-line interface.

  2. Log in to the database.

    Input the command "sqlcmd -U <db_user> -P <password> -N -C", followed by pressing the “Enter” key.

    <db_user>:the user name of the database you would like to back up.

    <password>: the password of your database user.

  3. Restore the database

    Input the command "restore database <db_name> from disk='<file>' with replace", followed by pressing the "Enter" key. Then enter the "go" command to perform the restoration.

That's it! You've restore the database successfully.

Copyright © 2021 Cloud Clusters Inc. all right reserved,powered by GitbookRevised on 05/10/2021

results matching ""

    No results matching ""